class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        std::vector<std::vector<int>> dp;
        for(int i = 1; i <= numRows; i++)
        {
            std::vector<int> cnt_dp(i, 1);
            dp.push_back(cnt_dp);
        }
        for(int i = 1; i < numRows; i++)
        {
            for(int j = 1; j < i; j++)
                dp[i][j] = dp[i-1][j-1] + dp[i-1][j];
        }

        return dp;
    }
};